package com.mg.admin.service.admin.impl;

import com.mg.admin.bean.admin.LogVO;
import com.mg.admin.dao.admin.LogMapper;
import com.mg.admin.page.PageBean;
import com.mg.admin.page.PageParam;
import com.mg.admin.service.admin.LogService;
import org.apache.ibatis.session.RowBounds;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class LogServiceImpl implements LogService {

	@Autowired
	private LogMapper logMapper;

	@Override
	public void insert(LogVO logVO) {
		logMapper.insert(logVO);
	}


	@Override
	public PageBean listForPage(LogVO logVO, PageParam pageParam) {
		RowBounds rb = new RowBounds(pageParam.getStart(),pageParam.getNumPerPage());
		List<LogVO> doList = logMapper.selectList(logVO,rb);
		int totalCount = logMapper.getCount(logVO);
		PageBean pageBean = new PageBean(pageParam.getCurrentPage(),pageParam.getNumPerPage(),totalCount,doList);

		return pageBean;
	}


}
